home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / CIncludes / Fonts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-06  |  8.4 KB  |  291 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Fonts.h
  3.  
  4.      Contains:    Font Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __FONTS__
  21. #define __FONTS__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. #if PRAGMA_ALIGN_SUPPORTED
  34. #pragma options align=mac68k
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT_SUPPORTED
  38. #pragma import on
  39. #endif
  40.  
  41.  
  42. enum {
  43.     systemFont                    = 0,
  44.     applFont                    = 1,
  45.     newYork                        = 2,
  46.     geneva                        = 3,
  47.     monaco                        = 4,
  48.     venice                        = 5,
  49.     london                        = 6,
  50.     athens                        = 7,
  51.     sanFran                        = 8,
  52.     toronto                        = 9,
  53.     cairo                        = 11,
  54.     losAngeles                    = 12,
  55.     times                        = 20,
  56.     helvetica                    = 21,
  57.     courier                        = 22,
  58.     symbol                        = 23,
  59.     mobile                        = 24,
  60.     commandMark                    = 17,
  61.     checkMark                    = 18,
  62.     diamondMark                    = 19
  63. };
  64.  
  65. enum {
  66.     appleMark                    = 20,
  67.     propFont                    = 36864,
  68.     prpFntH                        = 36865,
  69.     prpFntW                        = 36866,
  70.     prpFntHW                    = 36867,
  71.     fixedFont                    = 45056,
  72.     fxdFntH                        = 45057,
  73.     fxdFntW                        = 45058,
  74.     fxdFntHW                    = 45059,
  75.     fontWid                        = 44208
  76. };
  77.  
  78. struct FMInput {
  79.     short                            family;
  80.     short                            size;
  81.     Style                            face;
  82.     Boolean                            needBits;
  83.     short                            device;
  84.     Point                            numer;
  85.     Point                            denom;
  86. };
  87. typedef struct FMInput FMInput;
  88.  
  89. typedef struct privateFontResultRecord *privateFontResult;
  90.  
  91. struct FMOutput {
  92.     short                            errNum;
  93.     privateFontResult                fontResult;
  94.     UInt8                            boldPixels;
  95.     UInt8                            italicPixels;
  96.     UInt8                            ulOffset;
  97.     UInt8                            ulShadow;
  98.     UInt8                            ulThick;
  99.     UInt8                            shadowPixels;
  100.     SInt8                            extra;
  101.     UInt8                            ascent;
  102.     UInt8                            descent;
  103.     UInt8                            widMax;
  104.     SInt8                            leading;
  105.     SInt8                            curStyle;
  106.     Point                            numer;
  107.     Point                            denom;
  108. };
  109. typedef struct FMOutput FMOutput;
  110.  
  111. typedef FMOutput *FMOutPtr;
  112.  
  113. struct FontRec {
  114.     short                            fontType;                    /*font type*/
  115.     short                            firstChar;                    /*ASCII code of first character*/
  116.     short                            lastChar;                    /*ASCII code of last character*/
  117.     short                            widMax;                        /*maximum character width*/
  118.     short                            kernMax;                    /*negative of maximum character kern*/
  119.     short                            nDescent;                    /*negative of descent*/
  120.     short                            fRectWidth;                    /*width of font rectangle*/
  121.     short                            fRectHeight;                /*height of font rectangle*/
  122.     unsigned short                    owTLoc;                        /*offset to offset/width table*/
  123.     short                            ascent;                        /*ascent*/
  124.     short                            descent;                    /*descent*/
  125.     short                            leading;                    /*leading*/
  126.     short                            rowWords;                    /*row width of bit image / 2 */
  127. };
  128. typedef struct FontRec FontRec;
  129.  
  130. struct FMetricRec {
  131.     Fixed                            ascent;                        /*base line to top*/
  132.     Fixed                            descent;                    /*base line to bottom*/
  133.     Fixed                            leading;                    /*leading between lines*/
  134.     Fixed                            widMax;                        /*maximum character width*/
  135.     Handle                            wTabHandle;                    /*handle to font width table*/
  136. };
  137. typedef struct FMetricRec FMetricRec, *FMetricRecPtr, **FMetricRecHandle;
  138.  
  139. struct WidEntry {
  140.     short                            widStyle;                    /*style entry applies to*/
  141. };
  142. typedef struct WidEntry WidEntry;
  143.  
  144. struct WidTable {
  145.     short                            numWidths;                    /*number of entries - 1*/
  146. };
  147. typedef struct WidTable WidTable;
  148.  
  149. struct AsscEntry {
  150.     short                            fontSize;
  151.     short                            fontStyle;
  152.     short                            fontID;                        /*font resource ID*/
  153. };
  154. typedef struct AsscEntry AsscEntry;
  155.  
  156. struct FontAssoc {
  157.     short                            numAssoc;                    /*number of entries - 1*/
  158. };
  159. typedef struct FontAssoc FontAssoc;
  160.  
  161. struct StyleTable {
  162.     short                            fontClass;
  163.     long                            offset;
  164.     long                            reserved;
  165.     char                            indexes[48];
  166. };
  167. typedef struct StyleTable StyleTable;
  168.  
  169. struct NameTable {
  170.     short                            stringCount;
  171.     Str255                            baseFontName;
  172. };
  173. typedef struct NameTable NameTable;
  174.  
  175. struct KernPair {
  176.     char                            kernFirst;                    /*1st character of kerned pair*/
  177.     char                            kernSecond;                    /*2nd character of kerned pair*/
  178.     short                            kernWidth;                    /*kerning in 1pt fixed format*/
  179. };
  180. typedef struct KernPair KernPair;
  181.  
  182. struct KernEntry {
  183.     short                            kernStyle;                    /*style the entry applies to*/
  184.     short                            kernLength;                    /*length of this entry*/
  185. };
  186. typedef struct KernEntry KernEntry;
  187.  
  188. struct KernTable {
  189.     short                            numKerns;                    /*number of kerning entries*/
  190. };
  191. typedef struct KernTable KernTable;
  192.  
  193. struct WidthTable {
  194.     Fixed                            tabData[256];                /*character widths*/
  195.     privateFontResult                fontResult;                    /*font record used to build table*/
  196.     long                            sExtra;                        /*space extra used for table*/
  197.     long                            style;                        /*extra due to style*/
  198.     short                            fID;                        /*font family ID*/
  199.     short                            fSize;                        /*font size request*/
  200.     short                            face;                        /*style (face) request*/
  201.     short                            device;                        /*device requested*/
  202.     Point                            inNumer;                    /*scale factors requested*/
  203.     Point                            inDenom;                    /*scale factors requested*/
  204.     short                            aFID;                        /*actual font family ID for table*/
  205.     Handle                            fHand;                        /*family record used to build up table*/
  206.     Boolean                            usedFam;                    /*used fixed point family widths*/
  207.     UInt8                            aFace;                        /*actual face produced*/
  208.     short                            vOutput;                    /*vertical scale output value*/
  209.     short                            hOutput;                    /*horizontal scale output value*/
  210.     short                            vFactor;                    /*vertical scale output value*/
  211.     short                            hFactor;                    /*horizontal scale output value*/
  212.     short                            aSize;                        /*actual size of actual font used*/
  213.     short                            tabSize;                    /*total size of table*/
  214. };
  215. typedef struct WidthTable WidthTable;
  216.  
  217. struct FamRec {
  218.     short                            ffFlags;                    /*flags for family*/
  219.     short                            ffFamID;                    /*family ID number*/
  220.     short                            ffFirstChar;                /*ASCII code of 1st character*/
  221.     short                            ffLastChar;                    /*ASCII code of last character*/
  222.     short                            ffAscent;                    /*maximum ascent for 1pt font*/
  223.     short                            ffDescent;                    /*maximum descent for 1pt font*/
  224.     short                            ffLeading;                    /*maximum leading for 1pt font*/
  225.     short                            ffWidMax;                    /*maximum widMax for 1pt font*/
  226.     long                            ffWTabOff;                    /*offset to width table*/
  227.     long                            ffKernOff;                    /*offset to kerning table*/
  228.     long                            ffStylOff;                    /*offset to style mapping table*/
  229.     short                            ffProperty[9];                /*style property info*/
  230.     short                            ffIntl[2];                    /*for international use*/
  231.     short                            ffVersion;                    /*version number*/
  232. };
  233. typedef struct FamRec FamRec;
  234.  
  235. extern pascal void InitFonts(void)
  236.  ONEWORDINLINE(0xA8FE);
  237. extern pascal void GetFontName(short familyID, Str255 name)
  238.  ONEWORDINLINE(0xA8FF);
  239. extern pascal void GetFNum(ConstStr255Param name, short *familyID)
  240.  ONEWORDINLINE(0xA900);
  241. extern pascal Boolean RealFont(short fontNum, short size)
  242.  ONEWORDINLINE(0xA902);
  243. extern pascal void SetFontLock(Boolean lockFlag)
  244.  ONEWORDINLINE(0xA903);
  245. extern pascal FMOutPtr FMSwapFont(const FMInput *inRec)
  246.  ONEWORDINLINE(0xA901);
  247. extern pascal void SetFScaleDisable(Boolean fscaleDisable)
  248.  ONEWORDINLINE(0xA834);
  249. extern pascal void FontMetrics(FMetricRecPtr theMetrics)
  250.  ONEWORDINLINE(0xA835);
  251. extern pascal void SetFractEnable(Boolean fractEnable)
  252.  ONEWORDINLINE(0xA814);
  253. extern pascal short GetDefFontSize(void)
  254.  FIVEWORDINLINE(0x3EB8, 0x0BA8, 0x6604, 0x3EBC, 0x000C);
  255. extern pascal Boolean IsOutline(Point numer, Point denom)
  256.  TWOWORDINLINE(0x7000, 0xA854);
  257. extern pascal void SetOutlinePreferred(Boolean outlinePreferred)
  258.  TWOWORDINLINE(0x7001, 0xA854);
  259. extern pascal Boolean GetOutlinePreferred(void)
  260.  TWOWORDINLINE(0x7009, 0xA854);
  261. extern pascal OSErr OutlineMetrics(short byteCount, const void *textPtr, Point numer, Point denom, short *yMax, short *yMin, FixedPtr awArray, FixedPtr lsbArray, RectPtr boundsArray)
  262.  TWOWORDINLINE(0x7008, 0xA854);
  263. extern pascal void SetPreserveGlyph(Boolean preserveGlyph)
  264.  TWOWORDINLINE(0x700A, 0xA854);
  265. extern pascal Boolean GetPreserveGlyph(void)
  266.  TWOWORDINLINE(0x700B, 0xA854);
  267. extern pascal OSErr FlushFonts(void)
  268.  TWOWORDINLINE(0x700C, 0xA854);
  269. #if CGLUESUPPORTED
  270. extern void getfnum(const char *theName, short *familyID);
  271. extern void getfontname(short familyID, char *theName);
  272. #endif
  273. extern pascal short GetSysFont( void )
  274.     TWOWORDINLINE( 0x3EB8, 0x0BA6 ); /* MOVE.w $0BA6,(SP) */
  275. extern pascal short GetAppFont( void )
  276.     TWOWORDINLINE( 0x3EB8, 0x0984 ); /* MOVE.w $0984,(SP) */
  277.  
  278. #if PRAGMA_IMPORT_SUPPORTED
  279. #pragma import off
  280. #endif
  281.  
  282. #if PRAGMA_ALIGN_SUPPORTED
  283. #pragma options align=reset
  284. #endif
  285.  
  286. #ifdef __cplusplus
  287. }
  288. #endif
  289.  
  290. #endif /* __FONTS__ */
  291.